home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_teTeX.idb / usr / freeware / bin / texshow.z / texshow
Text File  |  2001-01-10  |  3KB  |  91 lines

  1. eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
  2.         if 0;
  3.  
  4. #D \module
  5. #D   [       file=texshow.pl,
  6. #D        version=1999.03.30,
  7. #D          title=\TEXSHOW, 
  8. #D       subtitle=showing \CONTEXT\ commands,
  9. #D         author=Hans Hagen,
  10. #D           date=\currentdate,
  11. #D      copyright={PRAGMA / Hans Hagen \& Ton Otten},
  12. #D    suggestions={Tobias Burnus \& Taco Hoekwater}]
  13. #C
  14. #C This module is part of the \CONTEXT\ macro||package and is
  15. #C therefore copyrighted by \PRAGMA. See licen-en.pdf for 
  16. #C details. 
  17.  
  18. #D We need to find the module path. We could have used: 
  19. #D
  20. #D \starttypen 
  21. #D use FindBin ; 
  22. #D use lib $FindBin::Bin ;  
  23. #D \stoptypen
  24. #D
  25. #D But because we're sort of depending on \WEBC\ anyway, the
  26. #D next few lines are more appropriate: 
  27.  
  28. BEGIN 
  29.  { $cont_pm_path = `kpsewhich --format='other text files' --progname=context cont_mis.pm` ; 
  30.    $cont_pm_path =~ s/cont_mis\.pm.*// ; 
  31.    chop $cont_pm_path } 
  32.    
  33. use lib $cont_pm_path ; 
  34.  
  35. #D Now we can load some modules: 
  36.  
  37. use Getopt::Long ;
  38.  
  39. $Getopt::Long::passthrough = 1 ; # no error message
  40. $Getopt::Long::autoabbrev  = 1 ; # partial switch accepted
  41.  
  42. &GetOptions
  43.   (      "help" => \$ShowHelp , 
  44.     "interface" => \$Interface ) ;
  45.  
  46. cont_mis::banner ('TeXShow 0.1 - ConTeXt', 'PRAGMA ADE 1999') ;
  47.  
  48. if ($ShowHelp) 
  49.   { cont_mis::help ('--help', "print this help") ; 
  50.     cont_mis::help ('--interface', "primary interface") ; 
  51.     cont_mis::help ('string', "show info about command 'string'") ; 
  52.     cont_mis::help ('string lg', "show info about 'string' in language 'lg'") ; 
  53.     cont_mis::crlf () ;
  54.     exit 0 } 
  55.  
  56. use cont_mis ; 
  57. use cont_set ; 
  58.  
  59. use Tk ; 
  60.  
  61. #D This scripts is rather simple, because most of the action
  62. #D takes place in the module \type {cont_set.pm}.  
  63.  
  64. cont_mis::status ('searching for setup files') ; 
  65.  
  66. if (cont_set::setups_found) 
  67.   { cont_mis::status ('loading setups') ; 
  68.     cont_set::load_setups ;
  69.     cont_mis::status ('preparing display') ; 
  70.     cont_set::show_setups ; 
  71.     $command = $ARGV[0] ; 
  72.     $interface = $ARGV[1] ; 
  73.     if ($interface) 
  74.       { $Interface = $interface } 
  75.     if ($Interface) 
  76.       { cont_set::set_setup_interface($Interface) ; 
  77.         cont_mis::message ('primary interface', $Interface) } 
  78.     if ($command) 
  79.       { cont_mis::message ('searching command', $command) ; 
  80.         cont_set::show_setup ($command) } 
  81.     else 
  82.       { cont_mis::warning ('no command specified') ;
  83.         cont_set::set_setup_title('TeXShow : ConTeXt commands') }
  84.     cont_mis::status ('entering main loop') ; 
  85.     MainLoop () }
  86. else 
  87.   { cont_mis::error ('no setup files found') } 
  88.  
  89. END { cont_mis::crlf ;    
  90.       cont_mis::status ('closing down') }
  91.